package cur.nature.admin.service;

import cur.nature.admin.dao.admin_AddressDao;
import cur.nature.admin.model.po.admin_AddressPO;
import cur.nature.admin.model.vo.Admin_AddressVO;
import cur.nature.framework.mvc.crud.CrudService;
import cur.nature.tinyorm.core.bean.PageBean;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户信息 Service
 * 作者：Auto Generator By wujian
 * 生成日期：2024-02-15 21:03:32
 */
@Service
public class admin_AddressService extends CrudService<admin_AddressPO, Admin_AddressVO, admin_AddressDao> {
    public admin_AddressService(admin_AddressDao baseDao) {
        super(baseDao, admin_AddressPO.class, Admin_AddressVO.class);
    }

    public PageBean<Admin_AddressVO> list(Admin_AddressVO.list_Param param) throws Exception {
        PageBean<Admin_AddressVO> list = getDao().list(param);
        return list;
    }

    public Admin_AddressVO getDefaultAddress(Admin_AddressVO.getDefaultAddress_Param param) throws Exception {
        List<Admin_AddressVO> baseVOS = getDao().queryByCond(param);
        return (baseVOS != null && baseVOS.size() > 0) ? baseVOS.get(0) : new Admin_AddressVO();
    }

    public Admin_AddressVO queryById(Long addressId) throws Exception {
        return getDao().queryById(addressId);
    }
}

